import axios from '@/api/fetch';
//import * as types from './types';
import SERVER from '@/api/server';

//特殊用户保修期维护-主机厂

//特殊用户保修期维护-主页面查询
export const getListByPage = params => axios.post(`${SERVER.CLAIMFAC}/specialUser/getListByPage`, params  );
//新增的保存
export const newSave = params => axios.post(`${SERVER.CLAIMFAC}/specialUser/saveOne`,  params );
//特殊用户保修期维护数据回显
export const queryData = params => axios.post(`${SERVER.CLAIMFAC}/specialUser/getSpecialUserById/${params}` );

//特殊用户保修期备件明细
export const querySparePartDetail = params => axios.get(`${SERVER.CLAIMFAC}/sparePartDetail/getPeriodBySpId/${params}`  );

//VIN删除
export const delVINById = params => axios.post(`${SERVER.CLAIMFAC}/VINDetail/delVINById/${params}`  );

//新增Car
export const newSaveCar = params => axios.post(`${SERVER.CLAIMFAC}/sparePartDetail/saveCar`,  params );

//查询VIN
export const findAllVIN = params => axios.post(`${SERVER.CLAIMFAC}/VINDetail/page`,  params );
//添加VIN
export const newSaveVIN = params => axios.post(`${SERVER.CLAIMFAC}/VINDetail/newSaveVIN`,  params );

//编辑保存特殊用户保修期
export const saveSpecialUserAndVinAndPart = params => axios.post(`${SERVER.CLAIMFAC}/specialUser/saveSpecialUserAndVinAndPart`,  params );

//获取所有VIN
export const getAllVIN = params => axios.get(`${SERVER.CLAIMFAC}/VINDetail/getAllVIN`);

//根据查询条件导出Excel数据
export const exportExcel = params => {
  return axios({
    url: `${SERVER.CLAIMFAC}/specialUser/exportExcel`,
    method: 'post',
    params: params,
    responseType: 'arraybuffer'
  });
};



//导出备件模版
export const downloadModel = params => {
  const url = `${SERVER.CLAIMFAC}/specialUser/exportExcel`;
  return axios({
    url,
    method: 'get',
    responseType: 'blob'
  });
};
//导出车辆模版
export const downloadModelPlus = params => {
  const url = `${SERVER.CLAIMFAC}/specialUser/exportExcelPlus`;
  return axios({
    url,
    method: 'get',
    responseType: 'blob'
  });
};
//导出
export const getListForExport = (params) => axios.post(`${SERVER.CLAIMFAC}/rPSelfPt/getListForExport`, params, {
    responseType: 'blob'
  });
export const getTjdetail = params =>
  axios.get(`${SERVER.CLAIMFAC}/rPSelfPt/selectById/${params.id}`, {
    params
  });
//下载中心导出
export const exporturl = params => axios.post(`/api/cmscloud.excel/downloadExcel/exportExcel/${params.CODE}`, params);
